package com.txunda.zhuohired.aty.manage.home;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.ants.theantsgo.util.L;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import com.txunda.zhuohired.R;
import com.txunda.zhuohired.base.Base2Aty;
import com.txunda.zhuohired.dialog.SelectJobTimeDialog;

/**
 * 创建人： Txd_Cjh
 * 创建时间： 2018/3/12 13:33
 * 功能描述：发布职位
 * 联系方式：jiahuanchen@126.com
 */

public class PostJobAty extends Base2Aty {
    /**
     * 标题
     */
    @ViewInject(R.id.tv_layout_blue_center)
    private TextView tv_layout_blue_center;
    /**
     * 发布
     */
    @ViewInject(R.id.tv_layout_blue_right)
    private TextView tv_layout_blue_right;
    /**
     * 职位类型
     */
    @ViewInject(R.id.tv_post_job_type)
    private TextView tv_post_job_type;
    /**
     * 工作时间
     */
    @ViewInject(R.id.tv_post_job_time)
    private TextView tv_post_job_time;

    private int REQUESTTYPECODE = 1;//职位类型
    private int REQUESTADDRESSCODE = 2;//工作地点

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        showStatusBar(R.id.layout_blue_head);
        tv_layout_blue_center.setText("发布职位");
        tv_layout_blue_right.setVisibility(View.VISIBLE);
        tv_layout_blue_right.setText("发布");
    }

    @Override
    @OnClick({R.id.tv_layout_blue_right, R.id.ll_post_job_type, R.id.ll_post_job_address, R.id.ll_post_job_time, R.id
            .ll_post_job_welfare, R.id.ll_post_job_light_spot})
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.tv_layout_blue_right://发布

                break;
            case R.id.ll_post_job_type://职位类型
                startActivityForResult(SelectJobTypeAty.class, null, REQUESTTYPECODE);
                break;
            case R.id.ll_post_job_address://工作地点
                startActivityForResult(SelectJobAddressAty.class, null, REQUESTADDRESSCODE);
                break;
            case R.id.ll_post_job_time://工作时间
                SelectJobTimeDialog selectJobTimeDialog = new SelectJobTimeDialog(this, new SelectJobTimeDialog
                        .SelectTimeListener() {


                    @Override
                    public void onSelectTime(String time) {
                        L.e("===================", time);
                        tv_post_job_time.setText(time);
                    }
                });
                selectJobTimeDialog.show();
                break;
            case R.id.ll_post_job_welfare://公司福利
                startActivity(CompanyWelfareAty.class, null);
                break;
            case R.id.ll_post_job_light_spot://职位亮点
                startActivity(LightSpotAty.class, null);
                break;
        }
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.aty_post_job;
    }

    @Override
    protected void initialized() {

    }

    @Override
    protected void requestData() {

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (RESULT_OK == resultCode) {
            if (requestCode == REQUESTTYPECODE) {//职位类型
                L.e("========", "测试");
            } else if (requestCode == REQUESTADDRESSCODE) {//工作地点

            }
        }
    }
}
